<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vendure Dashboard</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #000;
            color: #fafafa;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .container {
            max-width: 480px;
            width: 90%;
            text-align: center;
        }

        .logo {
            margin: 40px 80px;
        }

        h1 {
            font-size: 32px;
            font-weight: 600;
            margin-bottom: 16px;
            letter-spacing: -0.5px;
        }

        .subtitle {
            font-size: 16px;
            color: #888;
            margin-bottom: 48px;
            line-height: 1.5;
        }

        .commands {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 48px;
        }

        .command {
            background: #111;
            border: 1px solid #333;
            border-radius: 8px;
            padding: 16px 20px;
            text-align: left;
            transition: border-color 0.2s ease;
        }

        .command:hover {
            border-color: #555;
        }

        .command-title {
            font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
            font-size: 14px;
            color: #fafafa;
            font-weight: 500;
            margin-bottom: 4px;
        }

        .command-desc {
            font-size: 13px;
            color: #888;
        }

        .footer {
            font-size: 14px;
            color: #666;
        }

        .footer a {
            color: #fafafa;
            text-decoration: none;
            border-bottom: 1px solid transparent;
            transition: border-color 0.2s ease;
        }

        .footer a:hover {
            border-bottom-color: #fafafa;
        }

        @media (max-width: 640px) {
            h1 {
                font-size: 28px;
            }

            .subtitle {
                font-size: 15px;
            }
        }
    </style>
    <link rel="icon" type="image/png" href="" />
</head>
<body>
    <div class="container">
        <svg class="logo" viewBox="0 0 539 100" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M198.715 29.7044C198.311 29.1369 197.638 28.7809 196.916 28.7809H189.317C188.393 28.7809 187.547 29.3774 187.239 30.2431L174.3 67.6252L161.16 30.2239C160.862 29.3581 160.034 28.7617 159.082 28.7617H151.261C150.54 28.7617 149.886 29.108 149.462 29.6852C149.058 30.2527 148.962 31.0031 149.183 31.6764L167.817 82.9974C168.115 83.8632 168.942 84.4404 169.866 84.4404H178.139C179.062 84.4404 179.889 83.8728 180.188 82.9974L198.927 31.6764C199.177 31.0031 199.081 30.2623 198.648 29.6852L198.696 29.714L198.715 29.7044Z" fill="#17C1FF"/>
            <path d="M252.778 58.3518C252.855 57.5342 252.903 56.4086 252.903 54.9465C252.903 49.7807 251.729 45.0286 249.43 40.8055C247.131 36.5825 243.88 33.1771 239.839 30.7145C235.77 28.2518 231.143 26.982 226.15 26.982C220.85 26.982 216.031 28.2711 211.836 30.8107C207.642 33.3503 204.343 36.9288 201.995 41.4212C199.667 45.8655 198.494 50.9639 198.494 56.553C198.494 62.142 199.696 67.2404 202.044 71.7135C204.42 76.2156 207.767 79.7941 211.99 82.3241C216.213 84.8636 221.081 86.1527 226.458 86.1527C232.23 86.1527 237.329 84.9887 241.619 82.6511C245.89 80.3135 249.392 77.0621 252.008 72.9834C252.633 71.9925 252.354 70.6746 251.383 70.0012L245.438 66.0476C244.938 65.7205 244.341 65.5955 243.735 65.7205C243.158 65.8456 242.639 66.2207 242.34 66.7113C240.792 69.299 238.695 71.3384 236.145 72.8006C233.596 74.2435 230.277 74.9842 226.256 74.9842C221.456 74.9842 217.791 73.4162 215.04 70.1648C212.644 67.327 211.163 64.0755 210.595 60.2469H250.613C251.739 60.2469 252.691 59.4004 252.787 58.2845V58.3326L252.778 58.3518ZM211.355 49.8288C212.25 46.7986 213.78 44.2397 215.925 42.0753C218.57 39.4395 221.899 38.1505 226.122 38.1505C230.345 38.1505 233.846 39.2664 236.318 41.5558C238.339 43.4413 239.791 46.231 240.59 49.8095H211.336L211.365 49.8384L211.355 49.8288Z" fill="#17C1FF"/>
            <path d="M305.417 36.6883C303.396 33.5042 300.645 31.0512 297.25 29.4062C293.931 27.819 290.227 26.9917 286.331 26.9917C282.108 26.9917 278.337 28.0114 275.086 30.0026C273.758 30.8203 272.537 31.7919 271.44 32.8885V30.9261C271.44 29.7333 270.468 28.7425 269.237 28.7425H261.743C260.541 28.7425 259.54 29.714 259.54 30.9261V82.2471C259.54 83.4399 260.512 84.4308 261.743 84.4308H269.237C270.439 84.4308 271.44 83.4592 271.44 82.2471V56.5722C271.44 50.7811 272.642 46.1348 275.009 42.8064C277.231 39.6704 280.559 38.1312 285.129 38.1312C292.978 38.1312 296.624 42.2773 296.624 51.2044V82.2471C296.624 83.4399 297.596 84.4308 298.827 84.4308H306.321C307.523 84.4308 308.524 83.4592 308.524 82.2471V47.9241C308.524 43.653 307.504 39.8724 305.503 36.6883H305.426H305.417Z" fill="#17C1FF"/>
            <path d="M368.839 0.4702H361.374C360.172 0.4702 359.171 1.44179 359.171 2.66349V32.9655C357.748 31.7149 356.17 30.6279 354.496 29.7525C351.081 27.944 347.253 27.0494 343.183 27.0494C337.893 27.0494 333.073 28.3384 328.869 30.8684C324.675 33.408 321.376 36.9577 319.038 41.4308C316.71 45.8559 315.536 50.9254 315.536 56.5433C315.536 62.1612 316.729 67.3462 319.086 71.8001C321.462 76.2925 324.81 79.8806 329.033 82.4202C333.246 84.9502 338.075 86.2393 343.405 86.2393C347.426 86.2393 351.197 85.3254 354.573 83.4976C356.228 82.6126 357.767 81.5641 359.171 80.3232V82.2856C359.171 83.4784 360.153 84.4692 361.374 84.4692H368.868C370.07 84.4692 371.071 83.4977 371.071 82.2856V2.65386C371.071 1.46102 370.099 0.460571 368.868 0.460571L368.839 0.4702ZM359.171 56.5914C359.171 60.1988 358.469 63.4599 357.074 66.2881C355.699 69.097 353.852 71.2133 351.399 72.7525C348.975 74.2916 346.281 75.0419 343.164 75.0419C340.047 75.0419 337.469 74.3012 335.093 72.7525C332.688 71.2133 330.841 69.0681 329.466 66.2688C328.061 63.431 327.369 60.1507 327.369 56.4663C327.369 52.782 328.071 49.6364 329.466 46.8563C330.841 44.0762 332.688 41.9791 335.093 40.4207C337.46 38.8816 340.115 38.1312 343.164 38.1312C346.214 38.1312 348.984 38.872 351.399 40.4207C353.794 41.931 355.699 44.1147 357.074 46.8851C358.479 49.7133 359.171 52.9744 359.171 56.5818V56.601V56.5914Z" fill="#17C1FF"/>
            <path d="M428.077 28.752H420.583C419.381 28.752 418.381 29.7237 418.381 30.9357V56.5818C418.381 62.3728 417.178 67.0191 414.812 70.3476C412.589 73.4836 409.261 75.0227 404.692 75.0227C396.852 75.0227 393.196 70.8766 393.196 61.9496V30.9069C393.196 29.714 392.225 28.7232 390.993 28.7232H383.5C382.297 28.7232 381.297 29.6948 381.297 30.9069V65.2299C381.297 69.501 382.316 73.2815 384.317 76.4657C386.337 79.6498 389.089 82.1124 392.484 83.7478C395.832 85.335 399.507 86.1623 403.403 86.1623C407.626 86.1623 411.397 85.1426 414.648 83.1513C415.976 82.3337 417.197 81.3909 418.323 80.2654V82.2278C418.323 83.4207 419.294 84.4115 420.526 84.4115H428.019C429.222 84.4115 430.222 83.4399 430.222 82.2278V30.9357C430.222 29.7429 429.251 28.752 428.019 28.752H428.068H428.077Z" fill="#17C1FF"/>
            <path d="M473.049 27.8863C471.221 27.3187 469.297 27.0205 467.325 27.0205C463.054 27.0205 459.177 28.2134 455.762 30.599C454.291 31.6187 452.915 32.8404 451.636 34.2545V30.9742C451.636 29.7814 450.664 28.7905 449.433 28.7905H441.939C440.737 28.7905 439.736 29.7621 439.736 30.9742V82.2952C439.736 83.488 440.708 84.4789 441.939 84.4789H449.433C450.635 84.4789 451.636 83.5073 451.636 82.2952V57.7362C451.636 53.5612 452.386 49.9346 453.887 46.9044C455.358 43.9511 457.311 41.6809 459.687 40.1417C462.063 38.6026 464.555 37.8523 467.306 37.8523C468.826 37.8523 470.182 38.1505 471.433 38.7469C472.106 39.074 472.905 39.0163 473.53 38.6219C474.155 38.2274 474.55 37.5252 474.55 36.7845V29.9738C474.55 29.031 473.924 28.1845 473.03 27.9151L473.059 27.8863H473.049Z" fill="#17C1FF"/>
            <path d="M527.14 58.3518C527.217 57.5342 527.266 56.4375 527.266 54.9465C527.266 49.7807 526.092 45.0093 523.822 40.8055C521.523 36.5825 518.271 33.1771 514.231 30.7145C510.162 28.2518 505.535 27.0109 500.542 27.0109C495.242 27.0109 490.422 28.2999 486.228 30.8395C482.034 33.3791 478.734 36.9577 476.387 41.45C474.069 45.8943 472.885 50.9928 472.885 56.5818C472.885 62.1708 474.088 67.2692 476.435 71.7424C478.811 76.2444 482.159 79.8229 486.401 82.3529C490.624 84.8925 495.492 86.1815 500.869 86.1815C506.641 86.1815 511.739 85.0176 516.03 82.68C520.301 80.3424 523.802 77.091 526.419 73.0122C527.044 72.0214 526.765 70.7035 525.794 70.0301L519.849 66.0764C519.349 65.7494 518.752 65.6243 518.146 65.7494C517.569 65.8744 517.069 66.2496 516.751 66.7402C515.202 69.3279 513.105 71.3672 510.527 72.8294C507.978 74.2724 504.659 75.0131 500.638 75.0131C495.838 75.0131 492.173 73.4451 489.422 70.1936C487.026 67.3558 485.545 64.1044 484.977 60.2758H525.005C526.13 60.2758 527.083 59.4292 527.179 58.3133L527.15 58.3422L527.14 58.3518ZM485.718 49.8288C486.613 46.7986 488.142 44.2397 490.287 42.0753C492.933 39.4395 496.261 38.1505 500.484 38.1505C504.707 38.1505 508.199 39.2664 510.681 41.5558C512.701 43.4413 514.154 46.231 514.952 49.8095H485.699L485.728 49.8384L485.718 49.8288Z" fill="#17C1FF"/>
            <path fill-rule="evenodd" clip-rule="evenodd" d="M530.142 14.8805C526.563 14.8805 523.658 17.7856 523.658 21.3642C523.658 24.9427 526.563 27.8478 530.142 27.8478C533.72 27.8478 536.626 24.9427 536.626 21.3642C536.626 17.7856 533.72 14.8805 530.142 14.8805ZM522.215 21.3642C522.215 16.9872 525.765 13.4375 530.142 13.4375C534.519 13.4375 538.069 16.9872 538.069 21.3642C538.069 25.7411 534.519 29.2908 530.142 29.2908C525.765 29.2908 522.215 25.7411 522.215 21.3642Z" fill="#17C1FF"/>
            <path d="M529.699 20.71C530.142 20.71 530.469 20.6234 530.671 20.4503C530.863 20.2867 530.969 20.0078 530.969 19.623C530.969 19.2382 530.863 18.9688 530.671 18.8053C530.479 18.6418 530.152 18.5648 529.699 18.5648H528.786V20.7196H529.699V20.71ZM528.795 22.201V25.3756H526.631V16.9872H529.93C531.037 16.9872 531.845 17.17 532.354 17.5451C532.874 17.9107 533.124 18.4975 533.124 19.3055C533.124 19.8635 532.989 20.3156 532.73 20.6715C532.46 21.0178 532.066 21.2872 531.518 21.4507C531.816 21.5277 532.075 21.6816 532.316 21.9125C532.556 22.153 532.787 22.5089 533.028 22.9995L534.211 25.3756H531.912L530.883 23.2881C530.681 22.8744 530.469 22.5762 530.257 22.4319C530.046 22.278 529.757 22.1914 529.411 22.1914H528.805L528.795 22.201Z" fill="#17C1FF"/>
            <path d="M34.4303 53.2726V82.7762C34.4303 83.3053 34.7189 83.8055 35.171 84.0652L61.4424 99.2355C62.3851 99.7742 63.5394 99.7742 64.4822 99.2355L90.7535 84.0652C91.2153 83.7959 91.4942 83.3053 91.4942 82.7762V53.2726C91.4942 52.1279 90.2533 51.4064 89.2625 51.9836L64.4822 66.2881C63.5394 66.8268 62.3851 66.8268 61.4424 66.2881L36.6621 51.9836C35.6712 51.4064 34.4303 52.1279 34.4303 53.2726Z" fill="#17C1FF"/>
            <path d="M28.6392 15.2556L2.36781 30.4163C1.42508 30.955 0.8479 31.965 0.8479 33.0425V63.3733C0.8479 63.9024 1.13649 64.4026 1.58862 64.6623L27.1385 79.4189C28.1293 79.9961 29.3702 79.2746 29.3702 78.1299V49.5209C29.3702 48.4339 29.9474 47.4335 30.8902 46.8948L55.6705 32.5903C56.6613 32.0131 56.6613 30.5798 55.6705 30.0122L30.1206 15.2556C29.6588 14.9863 29.0913 14.9863 28.6295 15.2556H28.6392Z" fill="#17C1FF"/>
            <path d="M97.2852 15.2268L123.556 30.3874C124.499 30.9261 125.076 31.9362 125.076 33.0136V63.3444C125.076 63.8735 124.788 64.3737 124.336 64.6335L98.7858 79.3901C97.795 79.9672 96.5541 79.2458 96.5541 78.101V49.4921C96.5541 48.4051 95.9769 47.4046 95.0342 46.8659L70.2539 32.5615C69.263 31.9843 69.263 30.5509 70.2539 29.9834L95.8037 15.2268C96.2655 14.9574 96.833 14.9574 97.2948 15.2268H97.2852Z" fill="#17C1FF"/>
        </svg>
        <p class="subtitle">Build your dashboard or run in development mode to get started.</p>

        <div class="commands">
            <div class="command">
                <div class="command-title">npx vite</div>
                <div class="command-desc">Start development server</div>
            </div>
            <div class="command">
                <div class="command-title">npx vite build</div>
                <div class="command-desc">Build for production</div>
            </div>
        </div>

        <div class="footer">
            <a href="https://docs.vendure.io/guides/extending-the-dashboard/getting-started/" target="_blank">Documentation</a>
        </div>

        <div id="status" style="margin-top: 24px; font-size: 12px; color: #666;">
            Checking for dashboard availability...
        </div>
    </div>

    <script>
        let pollInterval;
        let statusElement = document.getElementById('status');

        function statusUrlForCurrentPath() {
            const segments = location.pathname.split('/').filter(Boolean);
            return segments.length === 0 ? '/__status' : `/${segments[0]}/__status`;
        }

        function pollStatus() {
            fetch(statusUrlForCurrentPath())
                .then(response => response.json())
                .then(data => {
                    if (data.mode === 'vite') {
                        statusElement.textContent = 'Vite dev server detected! Refreshing...';
                        statusElement.style.color = '#4ade80';
                        setTimeout(() => globalThis.location.reload(), 500);
                    } else if (data.mode === 'built') {
                        statusElement.textContent = 'Built dashboard detected! Refreshing...';
                        statusElement.style.color = '#4ade80';
                        setTimeout(() => globalThis.location.reload(), 500);
                    } else {
                        statusElement.textContent = 'Waiting for dashboard to build or dev server to start...';
                        statusElement.style.color = '#666';
                    }
                })
                .catch(error => {
                    statusElement.textContent = 'Status check failed';
                    statusElement.style.color = '#ef4444';
                });
        }

        // Start polling every 2 seconds
        pollInterval = setInterval(pollStatus, 2000);

        // Initial check
        pollStatus();

        // Clean up interval when page unloads
        globalThis.addEventListener('beforeunload', () => {
            if (pollInterval) {
                clearInterval(pollInterval);
            }
        });
    </script>
</body>
</html>
